home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / schip_v1.1 < prev    next >
Internet Message Format  |  1995-03-23  |  16KB

  1. From erikmb@etek.chalmers.se Sun Jul  7 05:44:38 1991
  2. From: Erik Bryntse <erikmb@etek.chalmers.se>
  3. Subject: S-Chip v 1.1 (asc & uuencoded)
  4. To: spell@seq.uncwil.edu (Chris Spell)
  5. Date: Sun, 7 Jul 91 11:46:27 MET DST
  6. In-Reply-To: <9107011929.AA23120@seq.uncwil.edu>; from "Chris Spell" at Jul 1, 91 3:29 pm
  7. X-Mailer: ELM [version 2.3 PL8]
  8. Status: OR
  9.  
  10. Ok, here are a new version of S-CHIP. It is a lot faster than version
  11. 1.0 and have some new scroll functions. And it's still small!
  12.  
  13. I have copied parts of the original CHIP-48 documentation and added the
  14. new functions that are available in S-CHIP. 
  15.  
  16. If you would like to start writing games for CHIP, read this, get yourself 
  17. an assembler, look at someone else's program and get started! It's not 
  18. difficult, you can get something up and working in just an hour or so. 
  19. And you get the benefits of machine code - the speed - without having 
  20. to learn all the internals of the 48. And it won't crash when you do 
  21. something wrong (I hope...).
  22.  
  23. ... and by the way, H. Piper is exactly the kind of super fantastic
  24. games that I would like to see more of. Good work!
  25.  
  26.  
  27. SUPER-CHIP v1.1
  28. ===============
  29.  
  30. ... a modified version of the CHIP-8 game interpreter originally
  31. made by Andreas Gustafsson.
  32.  
  33. S-CHIP offers:
  34.  
  35. - full screen resolution in new extended screen mode
  36. - downward compability (you can run your old CHIP games)
  37. - higher speed in extended mode
  38. - a larger 16x16 sprite available
  39. - new, larger fonts for scores
  40. - you can pass information to and from a S-CHIP program
  41. - programmable exit from the S-CHIP interpreter possible
  42. - no need to turn off the clock
  43. - it will always start
  44. - instructions to scroll the screen down, left, and right
  45.  
  46.  
  47. Introduction to CHIP
  48. --------------------
  49.  
  50. For those who don't remember, the CHIP-8 programming language was
  51. used in a number of home computers based on RCA's CDP1802 pro-
  52. cessor in the late 1970's.  It's a small, interpreted language
  53. designed specifically  for writing simple video games.  It has
  54. less than 40 instructions, including arithmetic, control flow,
  55. graphics, and sound.  The instructions are all 16 bits long and
  56. are executed by a very compact virtual machine interpreter (the
  57. 1802 implementation was 512 bytes long).
  58.  
  59.  
  60. Technical specification 
  61. -----------------------
  62.  
  63. The CHIP-8 virtual machine is byte-addressable and has an address
  64. space of 4 kB at addresses 000-FFF hex.  However, addresses
  65. 000-1FF are reserved (this is where the CHIP-8 interpreter used to
  66. reside). Therefore, the CHIP-8 program itself begins at address
  67. 200. All instructions are 16 bits long and by convention instruc-
  68. tions always start at an even address. 
  69.  
  70. The machine has 16 8-bit general-purpose registers called V0..VF. 
  71. The VF register is modified by certain instructions and works as a
  72. carry flag and sprite collision indicator.  There is also a 16-bit
  73. pointer register I (though only the low 12 bits are generally
  74. used). 
  75.  
  76. A CHIP-8 program displays graphics by drawing sprites that are 8 
  77. pixels wide and 1..15 pixels high.  The screen resolution is 32 by
  78. 64 pixels in standard mode.  The origin is the upper left corner
  79. of the screen, and all coordinates are positive.  The sprites are
  80. stored in bigendian format, i.e., the most significant bit corre-
  81. sponds to the leftmost pixel. All drawing is done in XOR mode. If
  82. this causes one or more pixels to be erased, VF is <> 00, other-
  83. wise 00.
  84.  
  85. In extended screen mode the resolution is 64 by 128 pixels. A
  86. sprite of 16x16 size is available. 
  87.  
  88. There are two timers: the delay timer and the sound timer.  Both 
  89. timers count down about 60 times per second when nonzero; the
  90. speaker will beep whenever the sound timer is nonzero. 
  91.  
  92. In the instruction table below, NNN is a 12-bit address, KK is an 
  93. 8-bit constant, and X and Y are 4-bit register numbers.  Hex 
  94. characters represent themselves.  The two first characters of the 
  95. instruction code form the lower-address byte of the instruction,
  96. the first character being the more significant nibble. 
  97.  
  98. Instructions marked with (*) are new in SUPER-CHIP.
  99.  
  100. 00CN*    Scroll display N lines down
  101. 00E0     Clear display 
  102. 00EE     Return from subroutine
  103. 00FB*    Scroll display 4 pixels right
  104. 00FC*    Scroll display 4 pixels left
  105. 00FD*    Exit CHIP interpreter
  106. 00FE*    Disable extended screen mode
  107. 00FF*    Enable extended screen mode for full-screen graphics
  108. 1NNN     Jump to NNN 
  109. 2NNN     Call subroutine at NNN 
  110. 3XKK     Skip next instruction if VX == KK 
  111. 4XKK     Skip next instruction if VX <> KK 
  112. 5XY0     Skip next instruction if VX == VY 
  113. 6XKK     VX := KK 
  114. 7XKK     VX := VX + KK 
  115. 8XY0     VX := VY, VF may change 
  116. 8XY1     VX := VX or VY, VF may change 
  117. 8XY2     VX := VX and VY, VF may change 
  118. 8XY3     VX := VX xor VY, VF may change
  119. 8XY4     VX := VX + VY, VF := carry 
  120. 8XY5     VX := VX - VY, VF := not borrow 
  121. 8XY6     VX := VX shr 1, VF := carry 
  122. 8XY7     VX := VY - VX, VF := not borrow
  123. 8XYE     VX := VX shl 1, VF := carry 
  124. 9XY0     Skip next instruction if VX <> VY 
  125. ANNN     I := NNN 
  126. BNNN     Jump to NNN+V0 
  127. CXKK     VX := pseudorandom_number and KK 
  128. DXYN*    Show N-byte sprite from M(I) at coords (VX,VY), VF :=
  129.          collision. If N=0 and extended mode, show 16x16 sprite.
  130. EX9E     Skip next instruction if key VX pressed 
  131. EXA1     Skip next instruction if key VX not pressed 
  132. FX07     VX := delay_timer 
  133. FX0A     wait for keypress, store hex value of key in VX 
  134. FX15     delay_timer := VX 
  135. FX18     sound_timer := VX 
  136. FX1E     I := I + VX 
  137. FX29     Point I to 5-byte font sprite for hex character VX 
  138. FX30*    Point I to 10-byte font sprite for digit VX (0..9)
  139. FX33     Store BCD representation of VX in M(I)..M(I+2) 
  140. FX55     Store V0..VX in memory starting at M(I) 
  141. FX65     Read V0..VX from memory starting at M(I) 
  142. FX75*    Store V0..VX in RPL user flags (X <= 7)
  143. FX85*    Read V0..VX from RPL user flags (X <= 7) 
  144.  
  145.  
  146. Notes on the HP48SX implementation  
  147. ----------------------------------
  148.  
  149. CHIP-8 programs are stored in the HP48SX as string objects con-
  150. taining the bytes of the program in increasing address order,
  151. beginning with the byte at 0200.  The interpreter itself is a
  152. machine code object that should be run with the CHIP-8 program
  153. string on level 1. 4 kB of free memory is needed.  If an error is
  154. detected during execution, the address of the current CHIP-8
  155. instruction is returned as a binary integer on level 1. 
  156.  
  157. To quit, press the backspace key.  Pressing ENTER restarts the
  158. CHIP-8 program, and the +/- key turns the sound off or on. 
  159.  
  160. Subroutine nesting is limited to 16 levels. 
  161.  
  162. Most chip-8 programs are written for a 16-key hex keyboard with  
  163. following layout: 
  164.  
  165.   1 2 3 C                                               7 8 9 / 
  166.   4 5 6 D    This keyboard is emulated on the HP48SX    4 5 6 * 
  167.   7 8 9 E    using the following keys:                  1 2 3 - 
  168.   A 0 B F                                               0 . _ + 
  169.  
  170. This may cause some confusion with programs requiring numerical
  171. input. 
  172.  
  173.  
  174. Copyrights, etc
  175. ---------------
  176.  
  177. Parts of this document is copied from the original CHIP-48 docu-
  178. mentation written by Andreas Gustafsson. Below is the original
  179. copyright message for CHIP-48 v2.25
  180.  
  181. (c) Copyright 1990 Andreas Gustafsson
  182.  
  183. Noncommercial distribution allowed, provided that this copyright
  184. message is preserved, and any modified versions are clearly marked
  185. as such.
  186.  
  187. The program makes use of undocumented low-level features of the
  188. HP48SX calculator, and may or may not cause loss of data, ex-
  189. cessive battery drainage, and/or damage to the calculator hard-
  190. ware. The author takes no responsibility whatsoever for any damage
  191. caused by the use of this program.
  192.  
  193. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESSED OR
  194. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  195. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PUR-
  196. POSE.
  197.  
  198.  
  199. The modifications from CHIP v2.25 to S-CHIP v1.1 is made by 
  200.  
  201. Erik Bryntse
  202. (erikmb@etek.chalmers.se)
  203.  
  204.  
  205.  
  206. Download file in ASC-format
  207. ---------------------------
  208.  
  209. Download to your 48, use ASC-> and store as SCHIP.
  210.  
  211. To run a game, press SCHIP with the game string in level 1.
  212.  
  213. BEGIN_ASC schip.asc
  214. %%HP: T(3)A(R)F(.); 
  215. "CCD20EE0108FB97608FFBA81346C1208FD7B5013281AF04346C100CA81AF0281
  216. AF1C134AF2154716F154716F370000100415C781AF143417000C213434B55078
  217. 0821837D51341550780821807B418F2D76081AF123400400C213414713514334
  218. C2A208A6A1174143818F843400C108B23134FFFFF81AF0B6E3617471218F2D76
  219. 0174E78FB976081AF1A13481B43498E00C2135808210515F0F217015C1161CC9
  220. 6CBE81B434BAE00C21358082182147144164174CC96CFE84F808FD2108320028
  221. 1AF0B81AF143482000C2134D2144163144345C100C2134D215407BA2D2328311
  222. 34146DA1468A68F8082408F000EF281AF016394135147818F2F818F23144818F
  223. 2F818F2F818F21164A6C96C2E018A86115F015C0160170CC6AEF01D2312281AF
  224. 14C213414E96A92161156090AD116015E2801DAFC3200C0E3215C21B83100142
  225. 3408F000EF21118A64003D23108EA3408F000EF681AF017CC014E96A80A6E14C
  226. 16114E96A80A6E14C81AF143482000CA130320108018F06110DAD280115E3158
  227. 3FC0EF6808740080870008087370301037D601560FE8082010EF2154062EFD22
  228. 215702017114F1C101C6112C201D21570C6114C21340111413001D230F66EFD2
  229. 31016CDFD2311162DFD2312168CF172D21141570C6C2134D214E061C2D21570C
  230. 6C2134D014A07DE01F6F6D0E40E6611C13416E16E14803C681B4CA34FDC00C21
  231. 34D215E08018F06110DAD280116015E00EF201112118C6C213511413201114D6
  232. 136818F0D8BA40DA0177EEDAD2310E8A6141143417000CA3104D5130146134AF
  233. 2154716F154716F14C818F04A6D96D7D0331EE8A68311434C2000C21341428A8
  234. 00818F83140818F24C2134D215E310B0331FF8A6D181AF14345C100C213430F1
  235. 54003A6E8A6C181AF14345C100C2134D2154003A6E8A6606951A6E8A6A411434
  236. 17000C213431F3D7D01461641351577816155717F15771C0155717F1510A6F53
  237. D03A6E8A6D41143417000C213431F3D7D014616413517F157781215571CF1577
  238. 17015571C01510A6F50D03D6F68180AB90A606F80D1A888A90011434CA100CA1
  239. 3031F3B69D7D4C5C5C8146135136134E91361421321527151716F17F15271517
  240. 134184A6F59CAF08A912146184135151717F1517818F948AD3E03027BBB55280
  241. 864606FEA808085F8F2D760142164808C11B818F2112BC6112C2135D01701530
  242. 1C0C4C4D881B434A1000C2063412000C9C281B35F86340636D6F406450699065
  243. B067C063D06ED06FE06FB063C168C168D16FF1642364B3808085F11B1088DF75
  244. 3077FB10B0381AF1434C2000C2134142818F24C213681AF131583136142818F0
  245. 334040008B60014061BF73CB17114B14E966E012B818F2112B0373AB17114B14
  246. E962EE6FDF7ECB62DF76CB6AEF7D7B17114B148037E6B17114B14EA6214C0317
  247. 115B01C1D2906B0798B14803E690601797B0E6A15C103E690601746B0E6215C1
  248. 03E6906D17F4BAE80E690E62BEE0E6514C03E6906017D2BC215C16B5BE690651
  249. 781BBECC2E615C1614BE6906917EFAAEA8196215C1AE6672BE6906C070EADE65
  250. CF30E906017ECAC615C16CFA027F5A10803747A725AD014AC210B03706A34401
  251. 0013615A113617114F1C10E6214C03610281AF14345C100C2134156090A60619
  252. 071F848D90A6F74D381AF1877F91087A3AD731F10E6631F30E63171AE215F0A6
  253. 2AE53102B61550AE1AE215F0B6980D080CF2EA82201C17AD475A38EAB9FAE22E
  254. 90A50B6614C20037253118C6112C210878B9D731F30E6631F70E63171AF2AF11
  255. 5F090EB081862FB4506A62AE53104B61550AE107B6980D080CF201C173537A13
  256. 7139D914C037C09D214E7699AE3A8717114B1C131E9962D0311A962E002AEBAE
  257. 06F3DAEBAE0651D13606D3DB725990E218EF87F433B0768EF73D8314015C18E3
  258. 77F471DB722990E2E07134AEB030702787817114B1C131709668113606708814
  259. A071361480331A096661777F47014C03078CA5BF31519662114E0674480714C0
  260. 331819662114E0675380714C0331E196651D214E110A3A40010003319296681D
  261. 2D01520A86C6C6C210803310396602D2D01520A86C4C4CAC43105CA100033133
  262. 96260659014EAE781B4348E400C2134D096B42AEB808A0C015E205CA04162819
  263. 636EDF02D881AF1880824DFF008B2008ED27F134D4D222150016015401602115
  264. 0016015401602015001601540033155966E28ECB7F118D714E14D1361348BA01
  265. 171161B3755E02033156966E28E787F118D714F14C1361348BA01171161B3755
  266. E02033157966828E767F1F5D60714E14D1361341711618B6BE033158966828E8
  267. 37F1F5D60714F14C1361341711618B6BE0302114341B100C2134110140164111
  268. 14016411214016411314016401114341B100C213414210016414210116414210
  269. 216414210316401D6C4C4C2114CA3417000C2135DB819F2819F210A31300E633
  270. 17094980818627A6B10B81AF18134D014A949C0161F0F014A136818F2110881A
  271. F1BAF3AE7D2C68086040E681CCF5FED7147174112C21343102B6280821309498
  272. 08186019E650AE6A6E80D01561A9A0E1791A50B65A9F0E1AB9F0E17154120A4E
  273. 94A606E4F01C4D6C4C4C281AF14CA3417000C281AF09DB819F2819F2819F2C6C
  274. 681AF0A31700E63CB81AF0B81AF18134D014A818F2181AF0881AF1BD3A77A778
  275. 086080818F32819F0A6E54E81AF11130146818F0981AF0181AF12C21343102B6
  276. 280821809E650AE6A6E80D01561A9A0E1791AF080FD2E30180FDA9F0E1AB9F0E
  277. 17154116F16F161154120A4E94A60693F01F999F26227F1F8FF1F1F99F11F8F1
  278. FF8F9FF1244F9F9FF9F1FF9F99E9E9EF888FE999EF8F8FF8F88C3E77E3C3C3C3
  279. C7EE7C3818385818181818181C3E3F73C60C0810306FFFFC3E73C30E0E0303CE
  280. 7C360E0E163666CFFFF6060FFFF0C0CCFEF303CE7C3E3C70C0CCFEF3C3CE7C3F
  281. FFF3060C08103060606C3E73C3CE7E73C3CE7C3C3E73C3CF7F33030E3C710020
  282. 0400800610230460821148884824844422824221812814121116856"
  283. END_ASC
  284.  
  285. BEGIN_UU schip.uu
  286. begin 0666 schip.48
  287. M2%!(4#0X+47,+> . ?B;9X#_JQA#QB& W[<%,8*A#S1D' "L&/H@&/K!,:0O
  288. M471A'T47]G,   % 47P8^D%#<0# $D-#6P6'@!(XUQ5#406'@!((MQ3XTF> 
  289. MH1\R!$  +#$4=#$5-$,L*H!J&G$4-!CX2$, '( K$T/__X^A#VL^%D<7$OC2
  290. M9Q!'?OB;9X"A'QI#&$M#B0[ $E,(* $5]? 2!U$<8<&<QNL82T.K#L 24P@H
  291. M@1)T011&<<2<QN](CX#?$H C (*A#XNA'S2$ @ L,=021&$31$/% < 20RU1
  292. M!+<J+2,X$4-!UAIDJ(:/@$* #P#^@J$/89,44T&'@2^/@2\31!CX\ACX\ACX
  293. M$F&DQFDL#H&*%E$/40QA$ ?,IOX0+1,B&/I!+#$4Y&F:$A91!@G:$091+@C1
  294. M^CP"P. C42RQ. $0)$. #P#^$A&H1@#3,@'H.@3X .!O&/H0QPQ!GJ8(:A[$
  295. M81'D:8J@YD&,H1\TA ( K#$P @$(@0\6 :TM"!'E$X7S#/Z&@$< "'@ @( W
  296. M!P,!<VT09?".@ (!_A)%8.+?(A)U(! 701\<$&P1P@+1$G7 %D$L,00103$ 
  297. MT3+P9OXM$Q#&_2T3$2;]+1,2AOQQTA)!40=L+#'4$N1@P=(2=<#&$D,-00K7
  298. M#O'VUN $;A;!,13F81Z$,&P82ZQ#WPS $D,M40X(@0\6 :TM"!$&40[@+Q 1
  299. M$H%L+#$503$"$4%M,8:!#XVK!*T0=^ZM+1/@J!8404-Q , Z =05 T$60_H2
  300. M11?V471A'\08^$!JG=;7,!/NJ(8304,L , 20T&"B@ 8^#A!@($OQ!)#+5$^
  301. M 0LS\8]J'1CZ04/% < 20P,?10"CYJC&@:$?-%0< "PQU!)% */FJ&9@6:'F
  302. MJ*8404-Q , 20Q,_?0U!%D8Q%76'85%U<1]U%PQ1=7$?%:#V-0VCYJC6%$%#
  303. M<0# $D,3/WT-019&,17W47<8$E47_%%W<1!5%PQ1 6I?T#!M;Q@(N@EJ8(_0
  304. MH8BH"1!!0ZP!P!H#$S]KV=?$Q<489#$58S'D&6-!$B-1<E%Q81_W47)1<3$4
  305. M2&I?R?J FB%!%D@Q%147]U%Q&/A)J#T. W*[6R4(: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0TTM(E$ 81!%$ 82
  322. M40!A$$40!@)1 &$010 S495F+NB\]Q'8%^1!'6,QA*L0<1$6.U?E(# 396GF
  323. M@GYX'X%]01_$,19#N H1%V&Q<U4. C-1EV8HZ&?W\=4&%^1!'6,Q%!=A@6OK
  324. M,!.%:8:"CG,?7VUP01_$,19#<1$6N+8. Q)!0[$!P!)#$1 $810101!&$1($
  325. M810Q01!&$!$T%!L +#$4) $01D$2$&$4) $21D$2,&$$T<;$Q!)!K$-Q , 2
  326. M4[T8^8*1+P$Z,0!N,W&0E @8:')J&[ 8^H$QU!"D2<D0%@\/01IC&/@2 8BA
  327. M'ZL_ZM?"AH &!&X8S%_O?4$71Q'"$D,3(&N"@!(#28F @0:1;@7JIN8(#5$6
  328. MF@H>EZ$%:Z7YX*&;#QX712&@Y$EJ8$X/P=3&Q,2"H1_$.A0' "P8^I"]&/F"
  329. MD2\8^<+&AJ$/.G$ ;L.+H0^+H1\80PU!BH$O@:$/B*$?VZ-W>H> !@@8^",8
  330. M^:#F18ZA'Q$#08:!#XFA#X&A'\(20Q,@:X* $@CI5J!N:H[0$&6AJ>!Q&?J 
  331. M\"T^$ C?F@\>NOG@<5$481_V81%%(:#D26I@.0_QF?EB(O?Q^!\?G_D1CQ__
  332. M^/D?0O3Y^9\?__F9GI[^B/B>F?[X^(^/R.-W/CP\/'SNQX.!@X6!@8&!@<'C
  333. M\S=LP( ! _;_S^,W/.#@,##LQV/@X&%C9OS_;V#P_P\,S.\_,.S'X\,'#,SO
  334. M/SSLQ_/_/V# @ $#!@;&XS<\[.<W/.S'P^,W//SW,S#@PQ<  D  "& !,D &
  335. 2*!&$B(1"2$0B*"02&()!(1$!
  336.  
  337. end
  338. END_UU
  339.  
  340.